<!doctype html>
<html>

	<head>
		<meta charset="UTF-8">
		<title>{$Think.lang.project_title}</title>
		<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
		<link href="INDEX/css/mui.min.css" rel="stylesheet" />
		<link rel="stylesheet" type="text/css" href="INDEX/css/main.css"/>
		<link rel="stylesheet" type="text/css" href="INDEX/css/login.css"/>
	</head>

	<body>
		<script src="INDEX/js/mui.min.js"></script>
		<script type="text/javascript">
			mui.init()
		</script>
		<header class="mui-bar mui-bar-nav">
			<!--<a class="mui-switch "></a>-->
			<div class="mui-switch mui-pull-right  {if $think_var=='zh-cn'}mui-active{/if}" id="mySwitch">
  				<div class="mui-switch-handle"></div>
			</div>
			<h1 class="mui-title">{$Think.lang.project_title}</h1>
		</header>
		<div class="register_content">
			<div class="register_title" style="padding-top:44px ;">
				<h2>{$Think.lang.project_title}</h2>
			</div>
			<div class="register_user">
				<div class="user_name">
					<span class="user_img"></span>
					<input type="text" placeholder="{$Think.lang.username}" id="username"/>
				</div>
				<div class="user_pwd">
					<span class="user_pwd_img"></span>
					<input type="text" placeholder="{$Think.lang.pwd_encrypted}" id="chose_question" style="width: 82%;"/><span class="mui-icon mui-icon-arrowright" style="color: #C9AD7C;font-size:1.2em"></span>
					<span class="write_ans"></span><input type="text" placeholder="{$Think.lang.pwd_encrypted_answer_input}" id="chose_answer"/>
				</div>
			</div>
			<div class="register_now">{$Think.lang.forget_next}</div>
			<a href="{:Url('index/Login/login')}"><div class="forgot" style="color: #CBAB6F;">{$Think.lang.toLogin}</div></a> 
		</div>
		<div class="top_flood">
			<div class="question">
				<ul>
					
					{foreach $encrypt as $k=>$v}
					{if condition = "$think_var eq 'zh-cn'"}
						<li class="" data="{$v['id']}">{$v['question']}</li>
					{else}
					<li class="" data="{$v['id']}">{$v['question_en']}</li>
					{/if}
					{/foreach}
				</ul>
			</div>
		</div>
    </body>
    <script src="INDEX/js/switchover.js"></script>
	<script src="INDEX/js/jquery-1.8.0.min.js" type="text/javascript" charset="utf-8"></script>
	<script type="text/javascript">
		$(document).ready(function(){
	//		$(window).height() //浏览器当前窗口可视区域高度
			var width=$(document).width();
			var height=$(window).height();
			$(".register_content").css({"background":"url(INDEX/images/img/img_sign_in_bg.png) center no-repeat","width":width,"height":height,"background-size":"cover"});
			
			$(".top_flood .question ul li").click(function(){
				if(!$(this).hasClass("bac")){
					$(this).addClass("bac");
					$(this).siblings().removeClass("bac");
					$(".top_flood").css("display","none");
					$("#chose_question").val($(this).html())
				}
			})

			$(".register_now").click(function(){
				var username = $("#username").val();
				var question = $(".question").find(".bac").attr("data");
				var chose_question = $("#chose_answer").val();
				// 判断用户名是否为空
				if(username=="")
				{
					mui.toast("{$Think.lang.empty_username}");
					return false;
				}
				// 判断问题是否为空
				if(question==undefined)
				{
					mui.toast("{$Think.lang.empty_question}")
					return false;
				}
				// 判断答案是否为空
				if(chose_question=="")
				{
					mui.toast("{$Think.lang.encrypt_answer}")
					return false;
				}

				$.post("{:Url('Login/forget')}", {
                "username" : username,
                "question" : question,
				'chose_question' : chose_question
            }, function(data) {
                if (data['status'] > 0) {
                    //$(".sub_login").attr("disabled", "disabled");
					var user_id = data['user_id'];
                    window.location.href = "{:Url('Login/forget1')}?user_id="+ user_id;
                } else {
                    mui.toast(data["msg"])
                }
            });
				
			})
			
			$("#chose_question").click(function(){
				$(".top_flood").css("display","block");
			})
		})
		
	</script>
</html>